<?xml version="1.0" encoding="UTF-8" ?>
<!-- jsf:pagecode language="java" location="/src/pagecode/Import1.java" --><!-- /jsf:pagecode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html">
<h:head>
	<title>SSMS - Import</title>
	<meta http-equiv="Content-Type"
		content="application/xhtml+xml; charset=UTF-8" />
	<link rel="stylesheet" type="text/css" title="Style"
		href="theme/stylesheet.css" />
	<link rel="stylesheet" type="text/css" href="css/jquery.autocomplete.css"/>
	<link rel="stylesheet" type="text/css" href="js/ddsmoothmenu.css" />
	<link rel="stylesheet" type="text/css" href="js/ddsmoothmenu-v.css" />
	<script type="text/javascript" src="js/jquery-latest.js"></script>
	<script type='text/javascript' src="js/jquery.autocomplete.js"></script>
	<script type="text/javascript" src="js/ddsmoothmenu.js"></script>
	<script type="text/javascript">
		function findValue(li) {
			if( li == null ) return alert("No match!");
			// if coming from an AJAX call, let's use the CustId as the value
			if( !!li.extra ) var sValue = li.extra[0];
			// otherwise, let's just display the value in the text box
			else var sValue = li.selectValue;
		}
		function selectItem(li) {
			findValue(li);
		}
		function formatItem(row) {
			return row[0] + " (id: " + row[1] + ")";
		}
		$(document).ready(function() {
			$("#subview1-form1-custid1").autocomplete("faces/getIDs.jsp");
			$("#subview1-form1-custid1").blur(function() {
			  if($(this).val().length == 0)
			  	$(this).toggleClass('red');
			  else{
			    $(this).toggleClass('normal');
			  	$.ajax({
					url : "faces/getName.jsp?id=" + $(this).val(),
					success : function (data) {
					$("#subview1-form1-custName1").val(data.trim());
					}
				});
				$.ajax({
					url : "faces/getSpace.jsp?id=" + $(this).val(),
					success : function (data) {
					$("#subview1-form1-avaiSpace1").val(data.trim());
					}
				});
			  }
			});
			$('#subview1-form1-shipmentid1').blur(function() {
			  if($(this).val().length == 0)
			  	$(this).toggleClass('red');
			  else
			  	$(this).toggleClass('normal');
			});
			$('#subview1-form1-number1').blur(function() {
			  var value = $(this).val();
			  if(value.length == 0 || value == '0')
			  	$(this).toggleClass('red');
			  else
			  	$(this).toggleClass('normal');
			  $('#subview1-form1-spaceRequired1').val(value);	
			});
		});
		function autoFill(custid) {
		};
		ddsmoothmenu.init({
		mainmenuid: "smoothmenu1", //menu DIV id
		orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
		classname: 'ddsmoothmenu', //class added to menu's outer DIV
		//customtheme: ["#1c5a80", "#18374a"],
		contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
		})
	</script>
</h:head>
<h:body>
<div id="container">
	<h:panelGrid styleClass="panelGrid" id="grid1">
			<h:graphicImage styleClass="graphicImage" id="image1" name="ssms.jpg"
				library="images" width="760" height="51"></h:graphicImage>
		</h:panelGrid>
	<div id="smoothmenu1" class="ddsmoothmenu">
		<ul>
		<li><a href="index.html">Home</a></li>
		<li><a href="#">Services</a>
		  <ul>
		  <li><a href="import.html">Import Service</a></li>
		  <li><a href="export.html">Export Service</a></li>
		  <li><a href="report.html">Report Service</a></li>
		  </ul>
		</li>
		<li><a href="#">Manage</a>
		  <ul>
		  <li><a href="addCustomer.html">Add New Customer</a></li>
		  </ul>
		</li>
		<li><a href="contact.html">Contact Us</a></li>
		</ul>
	<br style="clear: left" />
	</div>
	<hr />
	<div id="wrapper">
	<div id="content">
	<f:subview id="subview1">
		<ui:insert>
				<h2>Import Shipment</h2>
				<h:form styleClass="form" id="form1">
				<table>
					<tbody>
						<tr>
							<td align="left">Customer ID:</td>
							<td style="width: 5px">&#160;</td>
							<td><h:inputText styleClass="inputText" id="custid1"
									value="#{pc_Import1.goodsSpace.custid}" requiredMessage="Customer ID is required." validatorMessage="Customer ID is invalid.">
											<f:validator validatorId="customerValidator"></f:validator>
											</h:inputText></td>
						</tr>
		
						<tr>
							<td align="left">Customer Name:</td>
							<td style="width: 5px">&#160;</td>
							<td><h:inputText styleClass="inputText" id="custName1"
												readonly="true" value="#{pc_Import1.customerMstr.custname}">
											</h:inputText></td>
						</tr>
						<tr>
							<td align="left">Shipment ID:</td>
							<td style="width: 5px">&#160;</td>
							<td><h:inputText styleClass="inputText" id="shipmentid1"
									value="#{pc_Import1.goodsSpace.shipmentid}" requiredMessage="Shipment ID is required." validatorMessage="Shipment ID is invalid.">
								<f:validator validatorId="shipmentValidator"></f:validator>
								</h:inputText></td>
						</tr>
						<tr>
							<td align="left">No. units:</td>
							<td style="width: 5px">&#160;</td>
							<td><h:inputText styleClass="inputText" id="number1"
									value="#{pc_Import1.goodsSpace.number}">
									<f:validator validatorId="nouValidator"></f:validator>
								</h:inputText>
							</td>
						</tr>
						<tr>
							<td align="left">Required Space:</td>
							<td style="width: 5px">&#160;</td>
							<td><h:inputText styleClass="inputText" id="spaceRequired1"
												value="#{pc_Import1.goodsSpace.spaceRequired}"
												readonly="false">
											</h:inputText>
										</td>
						</tr>
						<tr>
							<td align="left">Available Space:</td>
							<td style="width: 5px">&#160;</td>
							<td><h:inputText styleClass="inputText" id="avaiSpace1"
								 value="#{pc_Import1.customerMstr.availablespace}" readonly="true">
								</h:inputText></td>
						</tr>
					</tbody>
				</table>
				<h:commandButton styleClass="commandButton" type="submit"
					value="Import" id="id1"
					action="#{pc_Import1.createGoodsSpaceAction}">
				</h:commandButton>
				<h:messages styleClass="messages" id="id2messages"></h:messages>
			</h:form>
		</ui:insert>
	</f:subview>
	</div>
	</div>
	<div id="footer">
		<h:outputText styleClass="outputText" id="text1" value="Created by SPHINX, 2011"></h:outputText>
	</div>
</div>
</h:body>
</html>